package com.steward.server.car.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.steward.commons.ConstData;
import com.steward.commons.Result;
import com.steward.dao.card.CardQueryMapper;
import com.steward.dao.code.CodeMapper;
import com.steward.dao.mob.MobGiftActiveMapper;
import com.steward.dao.mobCarset.MobCarsetMapper;
import com.steward.dao.vipCarType.VipCarTypeMapper;
import com.steward.dto.card.CarBandDTO;
import com.steward.dto.card.CarTypeDTO;
import com.steward.dto.card.CardConsumeDTO;
import com.steward.dto.card.SeriseDTO;
import com.steward.dto.card.UserCardDTO;
import com.steward.exceptions.StewardException;
import com.steward.model.code.Code;
import com.steward.model.mobCarset.MobCarset;
import com.steward.server.car.CarService;
import com.steward.server.card.CardService;

@Service
public class CarServiceImpl implements CarService {

	private static Logger logger = Logger.getLogger(CarServiceImpl.class);
	@Resource
	private CodeMapper codeMapper;
    
	@Resource
	private MobCarsetMapper mobCarsetMapper;
	
	@Resource
	private VipCarTypeMapper vipCarTypeMapper;

	@Override
	public Result<List<CarBandDTO>> queryCarBandList() {
		Result<List<CarBandDTO>> result = new Result<List<CarBandDTO>>();
		try {
			List<CarBandDTO> content = codeMapper.queryCarBandList();
			result.setContent(content);
			result.setCode(ConstData.SUCCESS_CODE);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			result.setCode(ConstData.NOT_FOUND_CODE);
		}
		return result;
	}


	@Override
	public Result<List<SeriseDTO>>  querySerisesByBandId(String bandId) {
		 
			Result<List<SeriseDTO>> result = new Result<List<SeriseDTO>>();
			try {
				List<SeriseDTO> content = mobCarsetMapper.querySerisesByBandId(bandId);
				result.setContent(content);
				result.setCode(ConstData.SUCCESS_CODE);
			} catch (Exception e) {
				logger.error(e.getMessage(), e);
				result.setCode(ConstData.NOT_FOUND_CODE);
			}
			return result;
		
	}


	@Override
	public Result<List<CarTypeDTO>> queryCarTypeBySerise(String seriseId) {
		Result<List<CarTypeDTO>> result = new Result<List<CarTypeDTO>>();
		try {
			List<CarTypeDTO> content = vipCarTypeMapper.queryCarTypeBySerise(seriseId);
			result.setContent(content);
			result.setCode(ConstData.SUCCESS_CODE);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			result.setCode(ConstData.NOT_FOUND_CODE);
		}
		return result;
	}


}